﻿using BLL.DTO.DataDto;
using DAL.Service;
using Helper;
using HZY.Framework.DependencyInjection;
using Mapster;
using Model;
using Model.Entity;
using Model.EntityInfo;

namespace BLL.Manager
{
    public class DataLogManager : IScopedSelfDependency
    {
        private readonly DataLogService _dataLogService;
        /// <summary>
        /// 运行数据日志列表
        /// </summary>
        /// <param name="dataLogService"></param>
        public DataLogManager(DataLogService dataLogService)
        {
            _dataLogService = dataLogService;
        }

        public async Task<BaseResult<ResPageData<DataLogInfoModel>>> GetDataLogListAsync(DataLogListDto query)
        {
            return await _dataLogService.GetDataLogListAsync(query.Page, query.PageSize, query.StartDate, query.EndDate);
        }
        /// <summary>
        /// 新增运行数据日志
        /// </summary>
        /// <param name="LogDto"></param>
        /// <returns></returns>
        public async Task<BaseResult<string>> CreateDataLogAsync(DataLogAddDto LogDto)
        {
            DataLogEntity LogEntity = LogDto.Adapt<DataLogEntity>();
            LogEntity.CreatedAt = new DateTime();
            return await _dataLogService.CreateDataLogAsync(LogEntity);
        }
    }
}
